package com.igame.Utils;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;


import java.util.HashMap;
import java.util.Map;

public class KaptchaUtil {
    public Map<String, String> defaultKaptcha() throws Exception {
        CircleCaptcha circleCaptcha = CaptchaUtil.createCircleCaptcha(150, 50, 4, 2);
        String codeValue = circleCaptcha.getCode();
        String imageBase64 = circleCaptcha.getImageBase64();
        Map<String, String> response = new HashMap<>();
        response.put("code", codeValue);
        response.put("image", "data:image/png;base64," + imageBase64);
        return response;
    }
}
